Adding an Email Field to a Form

HTML 5 has introduced a new input type for email addresses. You can now create an email field by using the <input type=”email” > tag. This tag is used to add an email address or a list of email addresses to a form, where type=”email” is a value for the input type. This tag provides a text box in which a user can enter email address, which is transferred to the Web server.

In other words, the email field provides the instructions to the browser to accept the string that conforms to a valid email address structure such as [email protected]. This input type provides built-in form validation that checks the format of email address and prompts an error if not correct.

Let’s do the following steps to add an email input type on a Web page:


<!DOTYPE html>
<head>
    <title>Adding Email Field</title>
</head>
<body>
    <h2>Example of Email Field </h2>
    <form>
        <h4> <label for=”email”>Provide Email Id for Subscription</label></h4>
        <input id=”email” name=”email” type=”email” autocomplete=”on” />
        <input type=”submit” value=”Go” />
    </form>
</body>
</html>

Save the document with the name AddingEmail.html and open on browser.

Enter some text in the Provide Email Id for subscription text box and click the Go button

Note : The email input type attribute value is not supported in Internet Explorer.